import { getSetting } from "@/api/setting"

export default {
  namespaced: true,
  state: {
    loading: false,
    data: null
  },
  mutations: {
    setLoading(state, payload) {
      state.loading = payload
    },
    setData(state, payload) {
      state.data = payload
    }  
  },
  actions: {
    async fetchSetting(context) {
      context.commit("setLoading", true)
      const resp = await getSetting()
      context.commit("setData", resp)
      context.commit("setLoading", false)
    }
  }
}